package zx.x.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.sys.entity.ActivityApplyEntity;
import zx.x.modules.sys.service.ActivityApplyService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 
 *
 * @author x
 * @email x
 * @date 2022-02-25 16:24:33
 */
@RestController
@RequestMapping("x/activityapply")
public class ActivityApplyController {
    @Autowired
    private ActivityApplyService activityApplyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("x:activityapply:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = activityApplyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("x:activityapply:info")
    public R info(@PathVariable("id") Integer id){
		ActivityApplyEntity activityApply = activityApplyService.getById(id);

        return R.ok().put("activityApply", activityApply);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("x:activityapply:save")
    public R save(@RequestBody ActivityApplyEntity activityApply){
		activityApplyService.save(activityApply);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("x:activityapply:update")
    public R update(@RequestBody ActivityApplyEntity activityApply){
		activityApplyService.updateById(activityApply);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //  @RequiresPermissions("x:activityapply:delete")
    public R delete(@RequestBody Integer[] ids){
		activityApplyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
